<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
   
  <meta name="keywords" content="Java Python" />
   
  <meta name="description" content="From Zero to Hero" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
     朱酱酱的学习博客
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/style.css">

  
<script src="/js/pace.min.js"></script>


  

  

<link rel="alternate" href="/atom.xml" title="朱酱酱的学习博客" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      
<section class="cover">
    
      
      <a class="forkMe" href="https://github.com/Zhuuuuuuuu"
        target="_blank"><img width="149" height="149" src="/images/forkme.png"
          class="attachment-full size-full" alt="Fork me on GitHub" data-recalc-dims="1"></a>
    
  <div class="cover-frame">
    <div class="bg-box">
      <img src="/images/cover4.jpg" alt="image frame" />
    </div>
    <div class="cover-inner text-center text-white">
      <h1><a href="/">朱酱酱的学习博客</a></h1>
      <div id="subtitle-box">
        
        <span id="subtitle"></span>
        
      </div>
      <div>
        
      </div>
    </div>
  </div>
  <div class="cover-learn-more">
    <a href="javascript:void(0)" class="anchor"><i class="ri-arrow-down-line"></i></a>
  </div>
</section>



<script src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js"></script>

<div id="main">
  <section class="outer">
  <article class="articles">
    
    
    
    
    <article id="post-JVM_Notes/JVM-10-类加载" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/12/JVM_Notes/JVM-10-%E7%B1%BB%E5%8A%A0%E8%BD%BD/"
    >JVM-10-类加载</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/12/JVM_Notes/JVM-10-%E7%B1%BB%E5%8A%A0%E8%BD%BD/" class="article-date">
  <time datetime="2020-02-12T00:38:38.000Z" itemprop="datePublished">2020-02-12</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-10-类加载"><a href="#JVM-10-类加载" class="headerlink" title="JVM-10-类加载"></a>JVM-10-类加载</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>​    </p>
<p>在上一篇文章中，我们详细介绍了Java的类文件结构（Class文件结构），那么这些个Class文件是如何被加载到内存，由虚拟机来使用的呢？这就是本篇将要介绍的——类加载过程。</p>
<p><strong>参考博客</strong> ： <a href="https://blog.csdn.net/ln152315/article/details/79223441" target="_blank" rel="noopener">https://blog.csdn.net/ln152315/article/details/79223441</a></p>
<h2 id="1-类的生命周期"><a href="#1-类的生命周期" class="headerlink" title="1. 类的生命周期"></a>1. 类的生命周期</h2><p>类从被加载到虚拟机内存开始，到卸载出内存为止，其声明周期流程如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200528/100029480.png" alt="mark"></p>
<p>上图中红色的五个部分（<strong>加载，验证，准备，初始化，卸载</strong>）的顺序都是固定的。也就是说，类的加载必须要按照这种循序按部就班的开始。这里的开始“开始”不是按部就班的“进行”或者“完成”，因为这些阶段通常都是互相交叉混合进行的，通常会在一个阶段执行过程汇总调用另一个阶段。</p>
      
      <a class="article-more-link" href="/2020/02/12/JVM_Notes/JVM-10-%E7%B1%BB%E5%8A%A0%E8%BD%BD/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-09-类文件结构" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/10/JVM_Notes/JVM-09-%E7%B1%BB%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84/"
    >JVM-09-类文件结构</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/10/JVM_Notes/JVM-09-%E7%B1%BB%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84/" class="article-date">
  <time datetime="2020-02-10T00:38:38.000Z" itemprop="datePublished">2020-02-10</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-09-类文件结构"><a href="#JVM-09-类文件结构" class="headerlink" title="JVM-09-类文件结构"></a>JVM-09-类文件结构</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>​    </p>
<p>计算机是由晶体管、电路板等组装而成的电子设备，而这些电子设备其实只能识别0与1的信号。</p>
<p>那么问题来了，在操作系统上编写的Java代码（由字母，数字等各种符号组成），打包后部署到服务器上，是如何被计算机所识别并运行的呢？</p>
<p>另外操作系统有很多种，包括Windows系统，Linux系统，Mac OS系统等，而我们同样的Java代码，却可以不做任何处理在不同系统上运行，这又是为什么呢？</p>
<p>带着这些疑问，你将在下面的内容中找到答案！！！</p>
      
      <a class="article-more-link" href="/2020/02/10/JVM_Notes/JVM-09-%E7%B1%BB%E6%96%87%E4%BB%B6%E7%BB%93%E6%9E%84/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-personal_server/GitHub-hexo-搭建个人博客" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/08/personal_server/GitHub-hexo-%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/"
    >GitHub+hexo搭建个人博客</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/08/personal_server/GitHub-hexo-%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/" class="article-date">
  <time datetime="2020-02-08T08:02:27.000Z" itemprop="datePublished">2020-02-08</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="GitHub-hexo搭建个人博客详细教程"><a href="#GitHub-hexo搭建个人博客详细教程" class="headerlink" title="GitHub+hexo搭建个人博客详细教程"></a>GitHub+hexo搭建个人博客详细教程</h1><p><img src="https://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200208160405.png" alt=""></p>
<h2 id="1-前言"><a href="#1-前言" class="headerlink" title="1. 前言"></a>1. 前言</h2><p>​        随着互联网浪潮的翻腾，国内外涌现出越来越多优秀的社交信息分享者，随之优秀的信息分享平台也越来越多，最常见的就是个人博客。GitHub + hexo 是比较受欢迎的一种方式，为什么呢？省钱、简单、快速。如果你也是一个不甘寂寞、喜欢折腾的程序猿（媛），如果你也有过这种想要搭建一个所以自己的博客网站的想法，可以跟着我这篇教程博客一起，它可以让你快速搭建起一个属于自己的个人博客，享受这种从0到1的过程。</p>
<p>朱酱酱的博客 ： <a href="http://zhuuu.work/">链接</a></p>
      
      <a class="article-more-link" href="/2020/02/08/personal_server/GitHub-hexo-%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Git/" rel="tag">Git</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/aliyun/" rel="tag">aliyun</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/hexo/" rel="tag">hexo</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/nodejs/" rel="tag">nodejs</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-config/IDEA-配置优化" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/08/config/IDEA-%E9%85%8D%E7%BD%AE%E4%BC%98%E5%8C%96/"
    >IDEA:配置优化</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/08/config/IDEA-%E9%85%8D%E7%BD%AE%E4%BC%98%E5%8C%96/" class="article-date">
  <time datetime="2020-02-08T07:40:41.000Z" itemprop="datePublished">2020-02-08</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="IDEA-配置优化"><a href="#IDEA-配置优化" class="headerlink" title="IDEA:配置优化"></a>IDEA:配置优化</h1><p>​        工欲善其事必先利其器，我平时比较喜欢使用IDEA，这个软件可以很大程度上提高工作效率。IDEA全称IntelliJ IDEA，是用于java语言开发的集成环境（也可用于其他语言），IntelliJ在业界被公认为最好的java开发工具之一，尤其在智能代码助手、代码自动提示、重构、J2EE支持、Ant、JUnit、CVS整合、代码审查、 创新的GUI设计等方面的功能可以说是超常的。IDEA是JetBrains公司的产品，这家公司总部位于捷克共和国的首都布拉格，开发人员以严谨著称的东欧程序员为主。<br>​        一直都有想过写一篇关于IDEA的设置优化的博文，因为确实网上的不是很适合我的风格。且网上的优化教程不是很多，自己摸索出来一下，希望能够帮到大家。</p>
      
      <a class="article-more-link" href="/2020/02/08/config/IDEA-%E9%85%8D%E7%BD%AE%E4%BC%98%E5%8C%96/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JAVA/" rel="tag">JAVA</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-08-监控和分析工具(可视化)" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/06/JVM_Notes/JVM-08-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%8F%AF%E8%A7%86%E5%8C%96)/"
    >JVM-08-监控和分析工具(可视化)</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/06/JVM_Notes/JVM-08-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%8F%AF%E8%A7%86%E5%8C%96)/" class="article-date">
  <time datetime="2020-02-06T02:38:38.000Z" itemprop="datePublished">2020-02-06</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-08-监控和分析工具-可视化"><a href="#JVM-08-监控和分析工具-可视化" class="headerlink" title="JVM-08-监控和分析工具(可视化)"></a>JVM-08-监控和分析工具(可视化)</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>上篇博客我们介绍了[虚拟机监控和分析命令行工具]，由于其不够直观，不是很容易排查问题，那么本篇博客我们就来介绍几个可视化工具。</p>
<h2 id="1-JConsole"><a href="#1-JConsole" class="headerlink" title="1. JConsole"></a>1. JConsole</h2><ul>
<li><p>JConsole（Java Monitoring and Management Console）是一款基于 JMX 的可视化监视和管理的工具。</p>
</li>
<li><p>它管理部分的功能是针对JMX MBean 进行管理，MBean可以使用代码，中间件服务器的管理控制台活着所有符合JMX规范的软件进行访问。</p>
</li>
</ul>
<h3 id="1-1-启动JConsole"><a href="#1-1-启动JConsole" class="headerlink" title="1.1 启动JConsole"></a>1.1 启动JConsole</h3><ul>
<li>这是我们<strong>JDK自带的监控工具</strong>，在JDK的安装目录bin下即可找到。</li>
<li>如果配置过JDK环境变量，在CMD命令提示符即可打开</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/144733963.png" alt="mark"></p>
<p>这是一个可执行文件，直接双击即可打开。打开如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/144844720.png" alt="mark"></p>
<h3 id="1-2-监控界面介绍"><a href="#1-2-监控界面介绍" class="headerlink" title="1.2 监控界面介绍"></a>1.2 监控界面介绍</h3><p>JConsole 这个监控工具可以监控本地进程以及远程进程，我们这里以监控本地进程为例，来介绍具体的监控界面。</p>
<p>点击本地进程下面的任意一栏，进入到监控界面。</p>
<ul>
<li><strong>监控概览</strong></li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/145028607.png" alt="mark"></p>
<p>这个界面是我们建立本地连接后，进入的第一个页面。显示的是整个虚拟机主要运行数据的概览，包括“堆使用情况”、“线程”、“类”、“CPU占用率”等四项信息的曲线图，这些曲线图是后面“内存”、“线程”、“类”页签的信息汇总，下面会分别介绍这几个页签。</p>
<ul>
<li><strong>内存监控</strong></li>
</ul>
<p>这个页面相当于上一篇介绍的jstat命令，只不过这里是可视化的，用于监控虚拟机内存的一些变化趋势.</p>
<p>监视区域如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/145158638.png" alt="mark"></p>
<ul>
<li><strong>线程监控</strong></li>
</ul>
<p>这个页面标签相当于介绍的可视化的jstack命令，遇到线程停顿的时候可以使用这个页面标签进行监控分析。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/145415085.png" alt="mark"></p>
<p>另外，此页面左下角还有一个检测死锁的按钮，出现线程死锁后，点击此按钮，便会出现一个新的死锁页签。</p>
<p>比如，对于如下这段死锁代码：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Deadlock</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">            Object lock1 = <span class="keyword">new</span> Object();</span><br><span class="line">            Object lock2 = <span class="keyword">new</span> Object();</span><br><span class="line"></span><br><span class="line">            <span class="keyword">new</span> Thread(()-&gt;&#123;</span><br><span class="line">                <span class="keyword">synchronized</span> (lock1)&#123;</span><br><span class="line">                    <span class="keyword">try</span> &#123;</span><br><span class="line">                        Thread.sleep(<span class="number">1000</span>);</span><br><span class="line">                    &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line">                        e.printStackTrace();</span><br><span class="line">                    &#125;</span><br><span class="line">                    <span class="keyword">synchronized</span> (lock2)&#123;</span><br><span class="line">                        System.out.println(<span class="string">"线程1结束运行"</span>);</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;).start();</span><br><span class="line"></span><br><span class="line">            <span class="keyword">new</span> Thread(()-&gt;&#123;</span><br><span class="line">                <span class="keyword">synchronized</span> (lock2)&#123;</span><br><span class="line">                    <span class="keyword">try</span> &#123;</span><br><span class="line">                        Thread.sleep(<span class="number">1000</span>);</span><br><span class="line">                    &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line">                        e.printStackTrace();</span><br><span class="line">                    &#125;</span><br><span class="line">                    <span class="keyword">synchronized</span> (lock1)&#123;</span><br><span class="line">                        System.out.println(<span class="string">"线程2结束运行"</span>);</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;).start();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>这里创建了两把锁，lock1,lock2，创建了两个线程，线程1获取到lock1后，说你给我lock2，我就释放lock1；而线程2获取到lock2后，说你给我lock1，我就释放lock2。两个线程谁也不释放，于是便造成了死锁现象。</p>
<p>通过监控工具便可以检查到，如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150111966.png" alt="mark"></p>
<ul>
<li>类监控</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150146700.png" alt="mark"></p>
<ul>
<li>VM概要</li>
</ul>
<p>展示一些JVM信息。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150235776.png" alt="mark"></p>
<h3 id="1-3-配置Tomcat远程监控"><a href="#1-3-配置Tomcat远程监控" class="headerlink" title="1.3 配置Tomcat远程监控"></a>1.3 配置Tomcat远程监控</h3><p>其实使用监控工具，我们很少对本地的程序进行监控，大多数情况都是对部署在远程Linux服务器上的程序进行监控，那么想要使用 JConsole这款工具进行远程监控，我们必须要进行一些配置。我们首先介绍对Tomcat的远程监控。</p>
<ol>
<li><strong>配置catalina.sh</strong></li>
</ol>
<p>在该文件下加入如下配置信息：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">JAVA_OPTS=<span class="string">"$JAVA_OPTS -Djava.rmi.server.hostname=192.168.146.200 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"</span></span><br></pre></td></tr></table></figure>

<p>　-Dcom.sun.management.jmxremote 表示开启远程连接。</p>
<p>　-Dcom.sun.management.jmxremote.port=1099 表示设置远程连接端口为1099</p>
<p>　-Dcom.sun.management.jmxremote.authenticate=false 表示不需要密码验证</p>
<p>　-Dcom.sun.management.jmxremote.ssl=fals 表示不需要开启ssl连接</p>
<p>　-Djava.net.preferIPv4Stack=true 表示只支持IPV4地址</p>
<p>　-Djava.rmi.server.hostname=192.168.146.200 表示监控的主机名为192.168.146.200</p>
<p>添加位置如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150754763.png" alt="mark"></p>
<ol start="2">
<li><strong>建立连接</strong></li>
</ol>
<p>通过上面的配置，启动Tomcat后，我们只需要在 JConsole 的远程连接界面，输入 192.168.146.200:1099，然后点击连接即可</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151023591.png" alt="mark"></p>
<ol start="3">
<li><strong>连接错误</strong></li>
</ol>
<ul>
<li><p>配置的端口不能被占用，可以通过 netstat -tunlp|grep 1099 命令验证。</p>
</li>
<li><p>云服务器的端口有没有添加安全组</p>
</li>
<li><p>通过 hostname -i 命令，如果打印的不是前面设置的ip地址，则需要通过 vim /etc/hosts 命令，将127.0.0.1 修改为本机IP地址。</p>
</li>
</ul>
<h3 id="1-4-配置远程jar包监控"><a href="#1-4-配置远程jar包监控" class="headerlink" title="1.4 配置远程jar包监控"></a>1.4 配置远程jar包监控</h3><p>启动jar包的命令如下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nohup java -Djava.rmi.server.hostname=<span class="number">192.168</span><span class="number">.146</span><span class="number">.200</span> -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=<span class="number">1089</span> -Dcom.sun.management.jmxremote.authenticate=<span class="keyword">false</span> -Dcom.sun.management.jmxremote.ssl=<span class="keyword">false</span> -jar jvm-<span class="number">0.0</span><span class="number">.1</span>-SNAPSHOT.jar &amp;</span><br></pre></td></tr></table></figure>

<p>配置端口，ip地址，和远程监控Tomcat大体上是一样的，然后建立连接即可。</p>
<h2 id="2-JVisualVM"><a href="#2-JVisualVM" class="headerlink" title="2. JVisualVM"></a>2. JVisualVM</h2><p>英文介绍为 All-in-One Java Troubleshooting Tool。听名字我们就知道这是一块功能很全，很强大的Java运行监视和故障处理工具，并且是官方主力发展的虚拟机故障处理工具，其性能分析比很多专业收费软件都不会逊色多少。</p>
<h3 id="2-1-启动JVisualVM"><a href="#2-1-启动JVisualVM" class="headerlink" title="2.1 启动JVisualVM"></a>2.1 启动JVisualVM</h3><p>和前面介绍的JConsole工具一样，这也是 JDK 自带的一个工具，在安装目录bin下，可以直接双击启动。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151328222.png" alt="mark"></p>
<p>打开界面如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151357191.png" alt="mark"></p>
<h3 id="2-2-监控界面介绍"><a href="#2-2-监控界面介绍" class="headerlink" title="2.2 监控界面介绍"></a>2.2 监控界面介绍</h3><p>其实大体界面和JConsole差不多。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151508736.png" alt="mark"></p>
<ul>
<li><strong>抽样器：可以对CPU，内存进行详细监控统计</strong></li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151549899.png" alt="mark"></p>
<ul>
<li><strong>插件机制</strong></li>
</ul>
<p>JVisualVM 比较强大的地方在与可以安装各种插件，提供各种不同的功能。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151628412.png" alt="mark"></p>
<p>然后设置插件中心的地址：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;visualvm.github.io&#x2F;pluginscenters.html</span><br></pre></td></tr></table></figure>

<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151832592.png" alt="mark"></p>
<p>选择对应的插件地址时，要根据我们的JDK版本来选定。</p>
<p>比如，我这边的JDK版本如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151920811.png" alt="mark"></p>
<p>插件会遇到的问题解决方案： <a href="https://blog.csdn.net/xionglangs/article/details/77603343" target="_blank" rel="noopener">https://blog.csdn.net/xionglangs/article/details/77603343</a></p>
<p>设置好下载地址后，<strong>我们这边选择需要的插件，点击安装即可！比如比较常用的插件 Visual GC(用来查看GC日志)</strong></p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151958195.png" alt="mark"></p>
<p>安装完成之后，我们便可以在页签上看到这个新增的插件。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/152015784.png" alt="mark"></p>
<h3 id="2-3-配置远程连接"><a href="#2-3-配置远程连接" class="headerlink" title="2.3 配置远程连接"></a>2.3 配置远程连接</h3><p>不管是远程连接Tomcat还是jar包，都和介绍JConsole一模一样，详情请参考上面的配置。</p>
<h3 id="2-4-使用文档"><a href="#2-4-使用文档" class="headerlink" title="2.4 使用文档"></a>2.4 使用文档</h3><p>对于JVisualvm，官方有详细的中文文档说明，如下：</p>
<p><a href="https://visualvm.github.io/documentation.html" target="_blank" rel="noopener">https://visualvm.github.io/documentation.html</a></p>

      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-07-监控和分析工具(命令行)" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/02/05/JVM_Notes/JVM-07-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%91%BD%E4%BB%A4%E8%A1%8C)/"
    >JVM-07-监控和分析工具(命令行)</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/05/JVM_Notes/JVM-07-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%91%BD%E4%BB%A4%E8%A1%8C)/" class="article-date">
  <time datetime="2020-02-05T02:38:38.000Z" itemprop="datePublished">2020-02-05</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-07-监控和分析工具-命令行"><a href="#JVM-07-监控和分析工具-命令行" class="headerlink" title="JVM-07-监控和分析工具(命令行)"></a>JVM-07-监控和分析工具(命令行)</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>通过前面的几篇，我们介绍了Java虚拟机的内存分配以及内存回收等理论知识，了解这些知识对于我们在实际生产环境中提高系统的运行效率是有很大的帮助的。</p>
<p>但是话又说回来，在实际生产环境中，线上项目正在运行，我们<strong>怎么去监控虚拟机的运行效率呢？</strong></p>
<p><strong>又或者是线上项目发生了OOM,异常堆栈的信息，我们又怎么去抓取，然后去分析定位问题的呢？</strong></p>
<p>本篇博客，我们就来介绍各种虚拟机监控和分析工具，当然都是命令行工具，不够直观，下篇博客我们会介绍各种可视化工具。</p>
      
      <a class="article-more-link" href="/2020/02/05/JVM_Notes/JVM-07-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%91%BD%E4%BB%A4%E8%A1%8C)/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-06-内存分配" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/01/30/JVM_Notes/JVM-06-%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D/"
    >JVM-06-内存分配</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/01/30/JVM_Notes/JVM-06-%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D/" class="article-date">
  <time datetime="2020-01-30T02:38:38.000Z" itemprop="datePublished">2020-01-30</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-06-内存分配"><a href="#JVM-06-内存分配" class="headerlink" title="JVM-06-内存分配"></a>JVM-06-内存分配</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>​    </p>
<p>Java是自动进行内存管理的，所谓自动化就是，不需要程序员操心，Java会自动进行<strong>内存分配</strong>和<strong>内存回收</strong>这两方面。</p>
<p>前面我们介绍过如何通过垃圾回收器来回收内存，那么这篇聊一聊如何进行内存分配。</p>
<ul>
<li>对象的分配，往大方向上讲，就是堆上进行分配（但是也有可能经过JIT编译后被差三位标量类型并间接在栈上分配）</li>
<li>对象主要分配在新生代 Eden 区上，如果启动了本地线程分配缓冲，将按线程优先在 TLAB 上分配</li>
<li>少数情况下也有可能直接分配在老年代上</li>
<li>分配的规则并不是百分之百固定的，其细节取决于当前使用哪一种垃圾收集器组合，还有虚拟机中与内存相关的参数设置。</li>
</ul>
<p>本篇会介绍几条最普遍的内存分配规则。通过增加 -XX:+UseParallelGC 参数，表示使用的垃圾收集器是 Parallel Scavenge + Serial Old ，通过这两个垃圾收集器组合进行校验。</p>
      
      <a class="article-more-link" href="/2020/01/30/JVM_Notes/JVM-06-%E5%86%85%E5%AD%98%E5%88%86%E9%85%8D/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-05-JVM参数" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/01/28/JVM_Notes/JVM-05-JVM%E5%8F%82%E6%95%B0/"
    >JVM-05-JVM参数</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/01/28/JVM_Notes/JVM-05-JVM%E5%8F%82%E6%95%B0/" class="article-date">
  <time datetime="2020-01-28T02:38:38.000Z" itemprop="datePublished">2020-01-28</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-05-JVM参数"><a href="#JVM-05-JVM参数" class="headerlink" title="JVM-05-JVM参数"></a>JVM-05-JVM参数</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>详细参数配置：<a href="https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html" target="_blank" rel="noopener">https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html</a></p>
<p>​    JVM参数有很多，其实我们直接使用默认的JVM参数，不去修改都可以满足大多数情况。</p>
<p>​    但如果在有限的硬件资源下，部署的系统达到最大的运行效率，那么进行相关的JVM参数设置是必不可少的。</p>
<p>​    下面我们就来对这些JVM参数进行详细的介绍。</p>
<p>​    JVM参数主要分为以下几种（可以根据书写形式来区分）：</p>
<h2 id="1-标准参数"><a href="#1-标准参数" class="headerlink" title="1. 标准参数"></a>1. 标准参数</h2><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200519/090115287.png" alt="mark"></p>
      
      <a class="article-more-link" href="/2020/01/28/JVM_Notes/JVM-05-JVM%E5%8F%82%E6%95%B0/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-04-垃圾收集器" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/01/27/JVM_Notes/JVM-04-%E5%9E%83%E5%9C%BE%E6%94%B6%E9%9B%86%E5%99%A8/"
    >JVM-04-垃圾收集器</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/01/27/JVM_Notes/JVM-04-%E5%9E%83%E5%9C%BE%E6%94%B6%E9%9B%86%E5%99%A8/" class="article-date">
  <time datetime="2020-01-27T02:38:38.000Z" itemprop="datePublished">2020-01-27</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-04-垃圾收集器"><a href="#JVM-04-垃圾收集器" class="headerlink" title="JVM-04-垃圾收集器"></a>JVM-04-垃圾收集器</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>上一篇介绍了几种常用的垃圾回收算法，包括标记-清除，标记整理，复制等，这些算法我们可以看做是内存回收的理论方法，那么在Java虚拟机中，由谁来具体实现这些方法呢？</p>
<p>没错，就是本篇博客介绍的内容——垃圾收集器。</p>
<h2 id="1-垃圾收集器的种类"><a href="#1-垃圾收集器的种类" class="headerlink" title="1. 垃圾收集器的种类"></a>1. 垃圾收集器的种类</h2><p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200518/104357156.png" alt="mark"></p>
<p>由上图我们可以总结出几个结论：</p>
      
      <a class="article-more-link" href="/2020/01/27/JVM_Notes/JVM-04-%E5%9E%83%E5%9C%BE%E6%94%B6%E9%9B%86%E5%99%A8/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
    <article id="post-JVM_Notes/JVM-03-垃圾回收" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h2 itemprop="name">
  <a class="article-title" href="/2020/01/26/JVM_Notes/JVM-03-%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6/"
    >JVM-03-垃圾回收</a
  >
</h2>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/01/26/JVM_Notes/JVM-03-%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6/" class="article-date">
  <time datetime="2020-01-26T02:38:38.000Z" itemprop="datePublished">2020-01-26</time>
</a>
      
      
      
      
    </div>
    

    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-03-垃圾回收"><a href="#JVM-03-垃圾回收" class="headerlink" title="JVM-03-垃圾回收"></a>JVM-03-垃圾回收</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>如果对C++这门语言熟悉的人，再来看Java，就会发现这两者对垃圾（内存）回收的策略有很大的不同。</p>
<ul>
<li>C++：垃圾回收很重要，我们必须要自己来回收！！！</li>
<li>Java：垃圾回收很重要，我们必须交给系统来帮我们完成！！！</li>
</ul>
<p>我想这也能看出这两门语言设计者的心态吧，</p>
<p><strong>总之，Java和C++之间有一堵由内存动态分布和垃圾回收技术所围成的高墙，墙外面的人想进去，墙里面的人想出来。</strong></p>
<p>本篇我们就来详细介绍Java的垃圾回收策略。</p>
      
      <a class="article-more-link" href="/2020/01/26/JVM_Notes/JVM-03-%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6/">阅读更多...</a>
      
      
      <!-- reward -->
      
    </div>
      <!-- copyright -->
      
    <footer class="article-footer">
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  

  
  
  

  

</article>
    
  </article>
  

  
  <nav class="page-nav">
    
    <a class="extend prev" rel="prev" href="/page/42/">上一页</a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/41/">41</a><a class="page-number" href="/page/42/">42</a><span class="page-number current">43</span><a class="page-number" href="/page/44/">44</a><a class="page-number" href="/page/45/">45</a><span class="space">&hellip;</span><a class="page-number" href="/page/52/">52</a><a class="extend next" rel="next" href="/page/44/">下一页</a>
  </nav>
  
</section>
</div>

      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2019-2021
        Zhuuu
      </li>
      <li>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="朱酱酱的学习博客"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/JVM/">JVM</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/JDK%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/">JDK源码</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/">多线程</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Mysql/">Mysql</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Redis/">Redis</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E8%AE%BE%E8%AE%A1%E8%80%85%E6%A8%A1%E5%BC%8F/">设计模式</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/MyBatis/">MyBatis</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/SpringMVC/">SpringMVC</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Spring/">Spring</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/SpringBoot/">SpringBoot</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/">Linux</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Leetcode/">Leetcode</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E5%89%8D%E7%AB%AF/">前端</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/">网络编程</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/photoshop/">photoshop</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="http://smartzhuuu.lofter.com/" target="_blank" rel="noopener">摄影</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
      
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<script src="/js/share.js"></script>



<script src="/fancybox/jquery.fancybox.min.js"></script>




<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['昨夜西风凋碧树。独上高楼，望尽天涯路','衣带渐宽终不悔，为伊消得人憔悴。','众里寻他千百度。蓦然回首，那人却在，灯火阑珊处。'],
    startDelay: 0,
    typeSpeed: 200,
    loop: true,
    backSpeed: 100,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script>
  var ayerConfig = {
    mathjax: true
  }
</script>


<script src="/js/ayer.js"></script>


<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>



<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>


<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>